package com.itlong.cloud.controller.value;

import com.fasterxml.jackson.core.type.TypeReference;
import com.itlong.cloud.POJO.DTO.operate.OperateAnalyseListDTO;
import com.itlong.cloud.POJO.DTO.operate.OperateModuleGetPageDTO;
import com.itlong.cloud.POJO.DTO.operate.OperatePropertySaveDeployDTO;
import com.itlong.cloud.POJO.DTO.operate.OperatePropertyValueSaveDTO;
import com.itlong.cloud.POJO.VO.MessageVO;
import com.itlong.cloud.POJO.VO.operate.OperateModuleGetPageVO;
import com.itlong.cloud.POJO.VO.operate.OperatePropertyValueGetOneVO;
import com.itlong.cloud.abstracts.BaseController;
import com.itlong.cloud.annotation.AuthAccessRequired;
import com.itlong.cloud.enumerate.ecode.BaseErrorCodeEnum;
import com.itlong.cloud.project.operate.IOperateColectionRateServiceClient;
import com.itlong.cloud.project.operate.IOperatePropertyValueServiceClient;
import com.itlong.cloud.thrown.DataAccessException;
import com.itlong.cloud.utils.network.http.HttpProtocolUtil;
import com.itlong.cloud.utils.node.JsonUtil;
import com.itlong.cloud.utils.page.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * <desc>
 *      运营-项目收缴率分析控制器
 * </desc>
 *
 * @createDate 2019/06/03
 */
@RestController
@RequestMapping("/propertyValue/colectionRate")
public class OperateColectionRateController extends BaseController{

    @Autowired
    IOperateColectionRateServiceClient iOperateColectionRateServiceClient;
    /**
     * <desc>
     *      获取列表
     * </desc>
     *
     * @param projectId
     * @param year
     * @return
     * @author Jiaqi.X
     * @createDate 2019/05/29
     */
    @RequestMapping(path = "list",method = RequestMethod.POST)
    @ResponseBody
    @AuthAccessRequired
    public Object list(String projectId,String year){
        MessageVO messageVO;
        try{
            HttpServletRequest request=((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
            projectId=request.getAttribute("projectId")==null?null:request.getAttribute("projectId").toString();
            year=request.getAttribute("year")==null?null:request.getAttribute("year").toString();
            messageVO=new MessageVO(BaseErrorCodeEnum.SUCCESS.getErrorCode(),iOperateColectionRateServiceClient.getList(year,projectId));
        }catch (Exception e){
            throw new DataAccessException("【运营_物业增值_项目收缴率分析list】获取列表失败",e);
        }
        return messageVO;
    }


}
